#!/bin/bash

if [ ! -f util/.serverpod_util_root ]; then
    echo "Run this script from the root of the Serverpod repository"
    echo "I.e. util/run_tests"
    exit 1
fi

# Makes script exit on first non-zero error code
set -e

echo "### Checking dart format"
dart format -o none --set-exit-if-changed .
echo ""

melos bootstrap

echo "### Running serverpod generate tests"
util/run_tests_serverpod_generate

echo "### Running update pubspecs test"
util/run_tests_update_pubspecs

echo "### Running dart analyze"
util/run_tests_analyze

echo "### Running unit tests"
util/run_tests_e2e
